package com.white.ndkmaster;

/**
 * Created by yutf on 2017/9/30 0030.
 */

public class NativeX
{
    static
    {
        System.loadLibrary("white");
        System.loadLibrary("bobo");
    }

    /***
     * MD5
     * @param s 待加密的串
     * @return
     */
    public native static String md5(String s);

    public native static String sha1(String s);


    /***
     * aes加密
     * @param key   密匙
     * @param src   待加密串
     * @return
     */
    public native static String aesEcbEncryptWithKey(String key, String src);

    /***
     * aes解密
     * @param src   待解密串
     * @return
     */
    public native static String aesEcbDecryptWithKey(String key, String src);

    /***
     *
     * cbc加密模式， 向量为16位，key 16 24 32；
     * @param iv
     * @param key
     * @param src
     * @return
     */
    public native static String aesCbcEncrypt(String iv, String key, String src);
    public native static String aesCbcDecrypt(String iv, String key, String src);

    /****
     * 获取app签名，是一个很长的字符串
     * @param context
     * @return
     */
    public native static String getSign(Object context);


    public native static byte[] crypt(Object context, byte[] ar);

    /***
     * 建字符串写入文件
     * @param path      绝对路径
     * @param content   待写入的内容
     * @return
     */
    public native static int writeString(String path, String content);

    /***
     * 建字符串写入文件
     * @param path      绝对路径
     * @return
     */
    public native static String readString(String path);
}
